package com.beiding.sqlbuilder.impl;

import com.beiding.sqlbuilder.*;

import java.util.ArrayList;
import java.util.List;

public class SimpleBuilderContext implements BuilderContext {

    private List<ConditionUnitHandler> conditionUnitHandlers = new ArrayList<>();

    private List<ParameterHandler> parameterHandlers = new ArrayList<>();

    private ReturnHandler returnHandler;

    private SelectHandler selectHandler;

    private TableHandler tableHandler;

    public void setTableHandler(TableHandler tableHandler) {
        this.tableHandler = tableHandler;
    }

    public void setSelectHandler(SelectHandler selectHandler) {
        this.selectHandler = selectHandler;
    }

    public void setReturnHandler(ReturnHandler returnHandler) {
        this.returnHandler = returnHandler;
    }

    @Override
    public List<ConditionUnitHandler> getConditionUnitHandlers() {
        return conditionUnitHandlers;
    }

    @Override
    public List<ParameterHandler> getParameterHandlers() {
        return parameterHandlers;
    }

    @Override
    public ReturnHandler getReturnHandler() {
        return returnHandler;
    }

    @Override
    public SelectHandler getSelectHandler() {
        return selectHandler;
    }

    @Override
    public TableHandler getTableHandler() {
        return tableHandler;
    }

    public void addConditionUnitHandler(ConditionUnitHandler conditionUnitHandler) {
        this.conditionUnitHandlers.add(conditionUnitHandler);
    }

    public void addParameterHandler(ParameterHandler parameterHandler) {
        this.parameterHandlers.add(parameterHandler);
    }

}
